<?php

namespace module\app\controller;

use app\Controller;
use app\model\Activity as Model;

class ActivityDetail extends Controller
{
    /**
     * 保存.
     * 
     */
    public function save()
    {
        $model = new Model;
        $model->save($this->request->post());
        return json($model->toArray());
    }
    
    /**
     * 详情.
     * 
     * @param int $id
     */
    public function read(int $id)
    {
        $model = Model::findOrFail($id);
        return json($model->toArray());
    }
    /**
     * 更新.
     * 
     * @param int $id
     */
    public function update(int $id)
    {
        $model = Model::findOrfail($id);
        $model->save($this->request->put());
        return json($model->toArray());
    }
}
